﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Timer
{
    class Timer
    {
        private DateTime startTime;
        private TimeSpan interval;
        private bool isRuning;

        public void Start()
        {
            if (isRuning)
            {
                Console.WriteLine("error, try again");
            }
            else
            {
                Console.WriteLine(@"The timer has been started.");
                startTime = DateTime.Now;
                isRuning = true;
            }
        }


        public void Stop()
        {
            if (isRuning)
            {
                interval += DateTime.Now - startTime;
                Console.WriteLine(@"The timer has been stoped.");
                Console.WriteLine(interval);
                isRuning = false;
            }
            else Console.WriteLine("error, try again");
        }

        public void Reset()
        {
            Console.WriteLine(@"The timer has been reseted.");
            interval = TimeSpan.Zero;
            isRuning = false;
        }
    }
}